package com.ynu.service.impl;

import com.ynu.bean.entity.CartItem;
import com.ynu.mapper.CartItemMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import com.ynu.mapper.CartMapper;
import com.ynu.bean.entity.Cart;
import com.ynu.service.CartService;

import java.util.List;

/**
*  模块名称：
*  模块类型：
*  编码人：迟宽席
*  创建时间：2023/3/4
*  联系电话：18388068273
*/
@Service
public class CartServiceImpl implements CartService{
    @Resource
    private CartMapper cartMapper;

    @Override
    public int emptyCartByPrimaryKey(Long id) {
        return cartMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int createSelective(Cart record) {
        return cartMapper.insertSelective(record);
    }

    @Override
    public Cart selectByPrimaryKey(Long id) {
        return cartMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(Cart record) {
        return cartMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public Cart selectByUserId(Long userId) {
        Cart cart = cartMapper.selectByUserId(userId);
        return cart;
    }

}
